﻿package org.leles.engines.beatgame 
{
	import flash.events.EventDispatcher;
	import org.leles.common.ITaggedObject;
	
	/**
	 * ...
	 * @author Bruno leles
	 */
	public class BeatGameSong extends BeatGameObject
	{
		// beats per second
		protected var _bps:uint;
		
		// TODO : trocar array por uma lista ligada
		// level notes
		private var _notes:Array /*of BeatGameNote*/;
		
		// length of the song
		protected var _length:Number;
		
		public function BeatGameSong(bps:uint = 20, length:Number = 0) 
		{
			super();
			_notes = new Array();
			setBps( bps );
			setLength( bps );
		}
		
		public function addNote(note:BeatGameNote):void 
		{
			if ( note.song && note.song !== this ) throw new Error( "Note alread in other song!" );
			
			note.song = this;
			_notes.push( note );
		}
		
		protected function setBps(value:uint):void		{			_bps = value;		}
		protected function setLength(value:Number):void	{			_length = value;		}
		
		public function get notes():Array/*of BeatGameNote*/ { return _notes; }
		public function get bps():uint { return _bps; }
		public function get length():Number { return _length; }
		
		
	}
	
}